package com.sh.boot_mq_consumer.consumer;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.TextMessage;

/**
 * @ClassName QueueConsume
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/10/27 14:28
 * @Version 1.0
 */
@Component
public class QueueConsumer {
    // 注册一个监听器。destination指定监听的主题。
    @JmsListener(destination = "${myqueue}")
    public void receive(TextMessage textMessage)throws Exception{
        System.out.println(textMessage.getText());
    }
}
